﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Text;
using Rodunu.Movies.Contracts;
using Rodunu.Movies.Services.Interfaces.Netflix;
using Rodunu.Movies.Services.Models.Netflix;
using Rodunu.Movies.Services.NetFlix.DataProvider;

namespace Rodunu.Movies.Services.NetFlix.Logic
{
    public class ManageUser : NetflixServiceBase, IManageUser
    {
        #region Constructors

        public ManageUser(string tokenKey)
            : base(tokenKey)
        {
            
        }

        public ManageUser()
        {

        }

        public ManageUser(UserInfo userId)
            : base(userId)
        {

        }

        #endregion

        #region IManageUser Members

        public TitleStates GetStateForDisc(string url)
        {
            var parameters = new NameValueCollection();
            return (TitleStates)
                _serializationHelper.FromXml(typeof(TitleStates), new StreamReader(_netflixService.GetUnprotected(url, parameters).GetResponseStream()).ReadToEnd());
        }

        #endregion
    }
}
